<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<style>
  
</style>
<body>
<!-- v-html:动态设置html标签内容,相当于innerHTML -->
<div id="app">

<button @click="fn(1)">点击</button>
</div>


<script src="https://cdn.jsdelivr.net/npm/vue@2.7.14/dist/vue.js"></script>
<script>
const app=new Vue({
    el:"#app",
    data:{
           list:[1,3,5,7,9]
    },
    methods:{
        fn(n){
        //   filter:过滤数组中的元素,返回一个新的数组
        //   (当前元素)=>{保留条件}
            console.log(this.list.filter(item=>item.id!=n));
            
        }
    }

})
</script>
</body>
</html>